﻿var pageCount = 0;
pageSize = 2;
//var template = {
//    tmp_table: '<tr><td>{$No}</td><td>{$userName}</td><td>{$sex}</td><td>{$type}</td><td>{$birthday}</td></tr>'
//};
$(document).ready(function () {
    GetOrderList(1);
})

function GetOrderList(pageClickedNum) {
    $("#OrdersList").empty().append("<img src='../App_Themes/images/loading.gif' />装载中....");
    JSONWebServiceA("../Handler/GetOrders.ashx", { pageNo: pageClickedNum, pageSize: pageSize, uid: $("#MainContent_cph_hid_uid").val() }, function (objJSON) {
        var json = JQueryExtend.EvalJSON(objJSON);
        if (json[0].ROW_COUNT > 0) {
            pageCount = Math.ceil(json[0].ROW_COUNT / pageSize);
            $("#pager").pager({ pagenumber: pageClickedNum, pagecount: pageCount, buttonClickCallback: GetOrderList });
            var contentHtml = "<table cellspacing='1' class='tableOne'><tr><td class='tableOne_title'>ID</td><td class='tableOne_title'>用户名</td><td class='tableOne_title'>sDate</td><td class='tableOne_title'>eDate</td><td class='tableOne_title'>价格</td><td class='tableOne_title'>操作</td></tr>";
            for (var i = 0; i < json.length; i++) {
                contentHtml += "<tr><td>" + json[i].OrderNO + "</td><td>" + json[i].uName + "</td><td>" + json[i].bookingSDate + "</td><td>" + json[i].bookingEDate + "</td><td>" + json[i].Price + "</td><td>审核</td></tr>";

            }
            contentHtml += "</table>";
            $("#divPager").css("display", "block");
            $("#OrdersList").css("display", "block");
            $("#OrdersList").html(contentHtml);
        }
        else {
            $("#OrdersList").css("display", "block");
            $("#OrdersList").html("没有数据！");
        }
    });

}